package com.pzr.soccer.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {

	@Bean
	public RestTemplate customRestTemplate() {
		SimpleClientHttpRequestFactory requestFactory=new SimpleClientHttpRequestFactory();
		    requestFactory.setConnectTimeout(10000);// 设置连接超时，单位毫秒
		    requestFactory.setReadTimeout(10000);  //设置读取超时
		    RestTemplate restTemplate = new RestTemplate();
		    restTemplate.setRequestFactory(requestFactory);
		    return restTemplate;
	}

}
